﻿@model CSF.Products.Data.ProductCategory
@using CSF.Products.Data

@{
    var qtypes = from p in ((List<ProductType>)ViewBag.ProductTypes)
                 where !p.IsDisable
                 select new SelectListItem { Value = p.Id.ToString(), Text = p.Name1, Selected = (Model == null) ? false : Model.ProductTypeId == p.Id };
    var productTypeList = qtypes.AsEnumerable();
}
@using (Html.BeginForm())
{  
    @Html.Hidden("ApplicationId", Model == null ? (int)ViewBag.AppId : Model.ApplicationId)
    @Html.HiddenFor(model => model.NameTextId)
    <div id="container">
        <div id="formStyle">
            <fieldset>
                <legend></legend>
                @Html.ValidationSummary(true)
                <p>
                    <label>
                        Last Level Category</label>
                    @Html.EditorFor(model => model.ParentId, "ProductCategorySelection", new { SelfId = (Model == null ? 0 : Model.Id) })
                    @Html.ValidationMessageFor(model => model.ParentId)
                </p>
                <p>
                    <label>
                        Code</label>
                    @Html.TextBoxFor(model => model.Code)
                    @Html.ValidationMessageFor(model => model.Code)
                </p>
                <p>
                    <label>
                        Name1</label>
                    @Html.EditorFor(model => model.Name1, "MultiLangTextInput")
                    @Html.ValidationMessageFor(model => model.Name1)
                </p>
                <p>
                    <label>
                        Product Type</label>
                    @Html.DropDownListFor(model => model.ProductTypeId, productTypeList)
                    @Html.ValidationMessageFor(model => model.ProductTypeId)
                </p>
                <p>
                    <label>
                        Sequence</label>
                    @Html.TextBoxFor(model => model.Sequence)
                    @Html.ValidationMessageFor(model => model.Sequence)
                </p>
                <p>
                    @Html.ActionLink("Back to List", "Index")
                </p>
            </fieldset>
            <p class="submit">
                <button type="submit">
                    @ViewBag.DetailMode</button></p>
        </div>
    </div>
}

